import java.util.Arrays;

public class C317 {
    public static void main(String[] args) {
        int[] a = {2, 5, 7, 9};
        int[] b = new int[64];
        int d=0;
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a.length; j++) {
                for (int n = 0; n < a.length; n++) {
                    int c = a[i] * 100 + a[j] * 10 + a[n];
                    b[d]=c;
                    d++;
                }
            }
        }
//        Arrays.sort(b);
        for(int i=0;i<b.length;i++){
            System.out.println(b[i]);
        }

    }
}
